import React from 'react';
import moment from 'moment';

interface IVTimeProps {
  text: string | string[];
  format: string;
}
const VTime: React.FC<IVTimeProps> = props => {
  const { text = [], format } = props;
  const times = Array.isArray(text) ? text : [text];
  return (
    <span>{times.map(time => moment(time).format(format)).join('~')}</span>
  );
};
export default VTime;
